<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%
    String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户注销申请</title>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>
<body>
<form id="sysUsrLoginOutform">
    <div class="fieldBox col_100">
        <div class="label" style="text-align: center;font-size: 18px;color: red;"><front>您是否要删除【融资租赁业务管理】系统账号，删除后次账号将不可再次登录业务系统。</front></div>
        <div class="label" style="margin-top: 15px;">注销原因</div>
        <div class="field" style="padding: 0 30px;">
            <c:forEach items="${causeMap }" var="kv" begin="0" step="1" varStatus="status">
                <c:if test="${status.index == 0}"><br>
                    <input type="radio" value="${kv.key }" onchange="radioChange()" name="sysUsrCauseCd"
                           checked/>${kv.value }
                </c:if>
                <c:if test="${status.index != 0}"><br>
                    <input type="radio" value="${kv.key }" onchange="radioChange()"
                           name="sysUsrCauseCd"/>${kv.value }
                </c:if>
            </c:forEach>
            <textarea placeholder="请输入其他原因" name="operDetail" id="operDetail" rows="5" class="l-textarea"
                      style="width:99%;margin-top: 15px;" value="" disabled="disabled"
                      validate="{required:false,maxlength:200}"></textarea>
        </div>
    </div>
</form>
<script>
    $(function () {
        $("#sysUsrLoginOutform").ligerForm({
            validate: true
        });
    });

    //定义父级调用事件
    frameElement.dialog.onOk = function () {
        save();
    }

    frameElement.dialog.onCancel = function () {
        frameElement.dialog.close();
    }

    function save() {
        var ligerForm = liger.get("sysUsrLoginOutform");
        if (!ligerForm.valid()) {
            UIUtils.alertWarning("有验证信息未通过!");
            return; //验证不通过，不执行以下代码
        }

        var data = ligerForm.getData();
        var url = '<%=path%>/system/sysUsr/usrLoginOut.do';
        AjaxUtils.ajaxPost(url, data, addCallback);
    }

    //新增回调
    function addCallback(msg) {
        debugger
        if (msg.success == 1) {
            UIUtils.alertSuccess("注销申请提交成功!");
            setTimeout(function(){
                $.cookie("liger-home-tab", "", {path:'/'});
                window.location.reload();
            }, 800);
        } else {
            UIUtils.alertError(msg.info);
        }
    }

    function radioChange() {
        debugger
        var _sysUsrCauseCd = $('input[type=radio][name="sysUsrCauseCd"]:checked').val();
        var obj = document.getElementById("operDetail");
        if ("3" == _sysUsrCauseCd) {
            obj.disabled = false;
        } else {
            obj.disabled = true;
        }
    }
</script>

</body>
</html>